﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Little_Tower_Defense.Interfaces;
using Little_Tower_Defense.Controller;

namespace Little_Tower_Defense._DrawableGameComponents.UIElements
{
    class VisuallMouse : Microsoft.Xna.Framework.DrawableGameComponent, IHoverable
    {
        public LittleTowerDefense Game { get; set; }

        public VisuallMouse(LittleTowerDefense game)
            : base(game)
        {
            this.Game = game;
        }

        int x = 0;
        int y = 0;
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here

            this.BackgroundTexture = Game.Content.Load<Texture2D>("Level\\Black");
            MouseController.AddListener(this);
            base.Initialize();
            DrawOrder = Int16.MaxValue;
        }

        protected override void LoadContent()
        {
            this.BackgroundTexture = Game.Content.Load<Texture2D>("Level\\Black");
        }

        public override void Update(GameTime gameTime)
        {

        }

        public override void Draw(GameTime gameTime)
        {
            MouseState asd = Mouse.GetState();
            SpriteBatch spriteBatch = new SpriteBatch(Game.GraphicsDevice);
            spriteBatch.Begin();
            spriteBatch.Draw(BackgroundTexture, new Rectangle(asd.X, asd.Y, 10, 10), Color.White);
            spriteBatch.End();
        }

        public Rectangle GetArea()
        {
            return (new Rectangle(0, 0, 1024, 768));
        }

        void IHoverable.Hover(int x, int y)
        {
            this.x = x;
            this.y = y;
        }

        public Texture2D BackgroundTexture { get; set; }
    }
}
